<?php
/**
 * Created by PhpStorm.
 * User: 29620
 * Date: 2021/10/29
 * Time: 14:04
 */
namespace app\admin\model;
use think\Model;
class BaseModel extends Model
{
    public static function getOne($where)
    {
        return static::where($where)->find();
    }


    //查询一条数据
    public static function getInfo($id)
    {
        return static::find($id);
    }
    //封装的添加
    public static function addInfo($data)
    {
        try{
            $res = self::create($data);
            $msg = 'ok';
        }catch (\Exception $e){
            $res = false;
            $msg = $e->getMessage();
        }
        return [$res,$msg];
    }
    //封装的修改
    public static function editInfo($data)
    {
        try{
            $res = self::update($data);
            $msg = 'ok';
        }catch (\Exception $e){
            $res = false;
            $msg = $e->getMessage();
        }
        return [$res,$msg];
    }
}




